using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;

using Tools = Home.PC.Tools;

namespace Home.PC.Tools.UI
{
    public partial class DirectoryTreeFlattener : UserControl, ITool
    {
        private Tools.DirectoryTreeFlattener _tool = null;

        public DirectoryTreeFlattener()
        {
            InitializeComponent();

            this._lblTitle.Text = this.ToolName;
        }

        private void _btnBrowseToSourceDirectory_Click(object sender, EventArgs e)
        {
            _sourceFolderBrowser.Description = "Select a source folder:";
            _sourceFolderBrowser.ShowNewFolderButton = false;
            _sourceFolderBrowser.RootFolder = Environment.SpecialFolder.MyDocuments;
            if (new DirectoryInfo(_txtSourceDirectory.Text).Exists)
            {
                _sourceFolderBrowser.SelectedPath = _txtSourceDirectory.Text;
            }
            _sourceFolderBrowser.ShowDialog();
            _txtSourceDirectory.Text = _sourceFolderBrowser.SelectedPath;
        }

        private void _btnBrowseToDestinationDirctory_Click(object sender, EventArgs e)
        {
            _sourceFolderBrowser.Description = "Select or create a destination folder:";
            _sourceFolderBrowser.ShowNewFolderButton = true;
            _sourceFolderBrowser.ShowDialog();
            _txtDestinationDirectory.Text = _sourceFolderBrowser.SelectedPath;
        }

        #region ITool Members

        public ToolType ToolType
        {
            get { return Tools.DirectoryTreeFlattener.ToolType; }
        }

        public string ToolName
        {
            get { return Tools.DirectoryTreeFlattener.ToolName; }
        }

        public string ToolDescription
        {
            get { return Tools.DirectoryTreeFlattener.ToolDescription; }
        }

        #endregion

        #region Explicit ITool Members

        ToolType ITool.ToolType
        {
            get { return this.ToolType; }
        }

        string ITool.ToolName
        {
            get { return this.ToolName; }
        }

        string ITool.ToolDescription
        {
            get { throw new Exception("The method or operation is not implemented."); }
        }

        #endregion Explicit ITool Members
    }
}